import Vue from 'vue'
import App from './App'
import util from './common/util.js'
import store from './store'

Vue.config.productionTip = false;//设置为 false 以阻止 vue 在启动时生成生产提示。
Vue.config.silent = true;//取消 Vue 所有的日志与警告。

Vue.prototype.rsa_publickey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAN5FMr3IShQUQgSC8gXZcxZVarND7CW+RqUcKM7C0ObOrTCtvz8ZIR8+oraKW0pYt04vknuCBtXlkIf9y0MFqEcCAwEAAQ==';

Vue.prototype.appId = 1;
Vue.prototype.appName = 'XXX-CHAT';
Vue.prototype.shortName = 'XXX-CHAT';


if (process.env.NODE_ENV === 'development') {
	console.log('开发环境');
	Vue.prototype.ApiUrl = 'http://127.0.0.1:8787/' //接口地址
	Vue.prototype.WssUrl = 'ws://127.0.0.1:2359'
} else {
	console.log('生产环境');
	Vue.prototype.ApiUrl = 'https://api.XXX.com/' //接口地址
	Vue.prototype.WssUrl = 'wss://api.XXX.com/wss/'
}


Vue.prototype.chatSocket = null
Vue.prototype.chatHeartbeatIntervalID = 0
Vue.prototype.reConnectIntervalID = 0


Vue.prototype.getUserInfo = function(){
	return Vue.prototype.getStore('userInfo');
};
Vue.prototype.setUserInfo = function(info){
	Vue.prototype.setStore('userInfo',info);
};
Vue.prototype.removeUserInfo = function(info){
	Vue.prototype.removeStore('userInfo');
};
Vue.prototype.setStore = function(key,val){
	uni.setStorageSync(Vue.prototype.appId+'_'+key,val);
};
Vue.prototype.getStore = function(key){
	return uni.getStorageSync(Vue.prototype.appId+'_'+key);
};
Vue.prototype.removeStore = function(key){
	uni.removeStorageSync(Vue.prototype.appId+'_'+key);
};
Vue.prototype.clearStore = function(key){
	uni.clearStorageSync();
};
Vue.prototype.$store = store;
Vue.prototype.$util = util;

App.mpType = 'app'

const app = new Vue({
	store,
    ...App
})
app.$mount()